package com.mobile.ado.contacts;

import android.graphics.Bitmap;
import android.os.Parcel;
import android.os.Parcelable;

public class PhoneNumber implements Parcelable {

	private String type;
	private String countryCode;
	private String cityCode;
	private String number;

	public PhoneNumber(String type, String countryCode, String cityCode,
			String number) {
		super();
		this.type = type;
		this.countryCode = countryCode;
		this.cityCode = cityCode;
		this.number = number;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public String getCountryCode() {
		return countryCode;
	}

	public void setCountryCode(String countryCode) {
		this.countryCode = countryCode;
	}

	public String getCityCode() {
		return cityCode;
	}

	public void setCityCode(String cityCode) {
		this.cityCode = cityCode;
	}

	public String getNumber() {
		return number;
	}

	public void setNumber(String number) {
		this.number = number;
	}

	@Override
	public String toString() {
		StringBuilder builder = new StringBuilder();
		builder.append(countryCode);
		builder.append(" ");
		if (type.equals("home")) {
			builder.append(cityCode);
			builder.append(" ");
		}
		builder.append(number);
		return builder.toString();
	}

	@Override
	public int describeContents() {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public void writeToParcel(Parcel paramParcel, int paramInt) {
		paramParcel.writeString(type);
		paramParcel.writeString(countryCode);
		paramParcel.writeString(cityCode);
		paramParcel.writeString(number);
	}

	public static final Parcelable.Creator<PhoneNumber> CREATOR = new Parcelable.Creator<PhoneNumber>() {
		public PhoneNumber createFromParcel(Parcel in) {
			return new PhoneNumber(in);
		}

		public PhoneNumber[] newArray(int size) {
			return new PhoneNumber[size];
		}
	};

	private PhoneNumber(Parcel in) {
		type = in.readString();
		countryCode = in.readString();
		cityCode = in.readString();
		number = in.readString();
	}

}
